﻿using System;
using System.Collections.Generic;
using System.Text;

namespace TimelineNet.Library {
    [Serializable()]
    public class GroupedEvent : Event {
        public string GroupName;

        public GroupedEvent(DateTime Start, DateTime End, bool IsDuration, string Title, string Image, string Description, string Thumbnail)
            : base(Start, End, IsDuration, Title, Image, Description, Thumbnail) {
        }

        public override string ToString() {

            lock(Library.Timeline.GroupedEventColors) {
                if(!Library.Timeline.GroupedEventColors.ContainsKey(this.GroupName)) {
                    Library.Timeline.GroupedEventColors.Add(this.GroupName, Library.Timeline.GroupColors[Library.Timeline.rnd.Next(Library.Timeline.GroupColors.Length)]);
                }
            }
            //base.Color = Library.Timeline.GroupedEventColors[this.GroupName];
            base.TextColor = Library.Timeline.GroupedEventColors[this.GroupName];

            return base.ToString();
        }
    }
}